/******************************************************************************
 * Author:      671643387
 * Created:     2016/9/30
 *****************************************************************************/

var ErrorCodes = {
    ERROR_NO_SUCH_ROOM              : 100,      // 房间不存在
    ERROR_ROOM_IS_FULL              : 101,      // 房间已满
    ERROR_QUERY_PLAYER_FAILED       : 102,      // 找不到玩家
    ERROR_ROOM_STATE_ERROR          : 103,      // 房间状态错误
    ERROR_PLAYER_ALREADY_IN_ROOM    : 104,      // 玩家已经在房间
    ERROR_INTERNAL_ERROR            : 105,      // 内部错误
    ERROR_PLAYER_NOT_IN_ROOM        : 106,      // 玩家不在房间里面
    ERROR_NOT_PLAYER_ROUND          : 107,      // 不该这个玩家出牌
    ERROR_PLAYER_PLAY_CARD_FAILED   : 108,      // 该人出牌失败
    ERROR_PLAYER_NOT_CREATOR        : 109,      // 玩家不是创建者
    ERROR_ROOM_ALREADY_REQD_DESTROY : 110,      // 房间已经被提交销毁申请
    ERROR_ROOM_NOT_REQD_DESTROY     : 111,      // 房间没有被提交销毁申请
    ERROR_PLAYER_ALREADY_ACCEPT     : 112,      // 玩家已经同意了销毁请求
    ERROR_PLAYER_PLAY_CARD_ERR      : 113,      // 玩家出牌牌型错误
    ERROR_PLAYER_PLAY_FRIST_CARD_ERR: 114,      // 首家出牌没有带红桃3
    ERROR_PLAYER_NOT_PLAY_DAYS_FRIED: 115,      // 玩家必须出天炸
    ERROR_PLAYER_NOT_PLAY_BOMB      : 116,      // 玩家不能出炸弹
};
var ErrorDesc = {
    100     : 'No such room',
    101     : 'Room is full',
    102     : 'Query player failed',
    103     : 'Room state error',
    104     : 'Player already in room',
    105     : 'Internal error',
    106     : 'Player not in room',
    107     : 'Not player play card',
    108     : 'Player play card failed',
    109     : 'Player not creator',
    113     : 'Player play card type error',
    114     : 'Player play frist play card error',
    115     : 'Player not play days fried error',
    116     : 'Player not play bomb',
};

exports.ErrorCodes = ErrorCodes;
exports.findString = function (code) {
    return ErrorDesc[code] || (code + '');
};